package br.edu.unifei.mestrado.mn;

import br.edu.unifei.mestrado.commons.graph.GraphWrapper;
import br.edu.unifei.mestrado.grafo.GrafoNeoDBView;

public class MainGraphView {

	public static void main(String[] args) {
		String file = null;

		// executar assim: main fileName.txt
		// ou sem nada, daí entra tudo via teclado
		if (args.length > 0) {
			file = args[0];
		} else {
			System.out.println("Uso: MainGraphView path_database");
			System.exit(2);
		}

		System.out.println("Iniciando View com Neo4J... file: " + file);

		MainGraphView main = new MainGraphView();
		main.execute(file);
	}

	public void execute(String file) {
		GraphWrapper grafo = new GrafoNeoDBView(file, GraphWrapper.NO_LEVEL);
		grafo.beginTransaction();
		grafo.readGraph();
		grafo.endTransaction();
		GraphViewDB view = new GraphViewDB();
		view.initView(grafo);
		// so para mostrar na tela
		view.updateView(grafo, 0, "CN: " + 0, -1);
	}
}
